<?php
/*********************************************
  CPG Dragonfly™ CMS
  ********************************************
  Copyright © 2004 - 2005 by CPG-Nuke Dev Team
  http://www.dragonflycms.com

  Dragonfly is released under the terms and conditions
  of the GNU GPL version 2 or any later version
Encoding test: n-array summation ∑ latin ae w/ acute ǽ
********************************************************/
if (!defined('CPG_NUKE')) { exit; }
if (!is_active('Surveys')) {
	$content = 'ERROR';
	return trigger_error('Surveys module is inactive', E_USER_WARNING);
}

global $currentlang, $content;

$K    = Dragonfly::getKernel();
$db   = $K->SQL;
$lang = ($K->L10N->multilingual ? "AND (planguage='{$currentlang}' OR planguage='')" : '');
$poll = $db->uFetchRow("SELECT
	poll_id
FROM {$db->TBL->poll_desc}
WHERE artid=0 AND poll_ptime<".time()." {$lang}
ORDER BY poll_ptime DESC");

if ($poll)
{
	require_once('modules/Surveys/poll.php');
	$OUT = $K->OUT;
	$OUT->poll = new Surveys_Poll($poll[0]);
	$content = $OUT->toString('Surveys/block');
	unset($OUT->poll);
}
else
{
	$content = sprintf(_ERROR_NONE_TO_DISPLAY, strtolower(_SurveysLANG));
}
